package org.roy.uibase;

import javax.microedition.lcdui.Canvas;

public abstract class BaseItem {
    private Rect iBoundingRect;
    private BaseItem iParent = null;
    private int iZOrder = 0;
    private boolean isVisible = false;
    protected Canvas iMaster;
    
    public BaseItem(BaseItem aParent, Canvas aCanvas) {
        iParent = aParent;
        iMaster = aCanvas;
        
        iBoundingRect = new Rect(0, 0, aCanvas.getWidth(), aCanvas.getHeight());
    }
    
    public Rect getBoundingRect() {
        return iBoundingRect;
    }

    public void setBoundingRect(Rect aBoundingRect) {
        this.iBoundingRect = aBoundingRect;
    }

    public BaseItem getParent() {
        return iParent;
    }

    public void setParent(BaseItem aParent) {
        this.iParent = aParent;
    }

    public int getZOrder() {
        return iZOrder;
    }

    public void setzOrder(int aZOrder) {
        this.iZOrder = aZOrder;
    }

    public boolean isVisible() {
        return isVisible;
    }

    public void setVisible(boolean aIsVisible) {
        this.isVisible = aIsVisible;
    }


    
    public void draw(){
        if(isVisible){
            drawItem();
        }
    }
    
    protected abstract void drawItem();
    
    public boolean handlePoniterPressed(){
        return false;
    }
}
